1 /* 2 * Copyright (c) 2011-2014 - Mauro Carvalho Chehab 3 * Copyright (c) 2012 - Andre Roth <neolynx@gmail.com> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU Lesser General Public License as published by 7 * the Free Software Foundation version 2.1 of the License. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 18 * 19 */ 20 21 module libdvbv5_d.desc_frequency_list; 22 23 import libdvbv5_d.descriptors: dvb_desc; 24 import libdvbv5_d.dvb_fe: dvb_v5_fe_parms; 25 26 extern (C): 27 28 /** 29 * @file desc_frequency_list.h 30 * @ingroup descriptors 31 * @brief Provides the descriptors for the frequency list descriptor. 32 * This descriptor lists the additional frequencies used in transmission 33 * of a multiplex on other frequencies. 34 * @copyright GNU Lesser General Public License version 2.1 (LGPLv2.1) 35 * @author Mauro Carvalho Chehab 36 * @author Andre Roth 37 * 38 * @par Relevant specs 39 * The descriptor described herein is defined at: 40 * - ETSI EN 300 468 V1.11.1 41 * 42 * @par Bug Report 43 * Please submit bug reports and patches to linux-media@vger.kernel.org 44 */ 45 46 /** 47 * @struct dvb_desc_frequency_list 48 * @ingroup descriptors 49 * @brief Struct containing the frequency list descriptor 50 * 51 * @param type descriptor tag 52 * @param length descriptor length 53 * @param next pointer to struct dvb_desc 54 * @param frequencies number of frequencies in the frequency vector 55 * @param frequency vector with the centre frequency 56 * @param freq_type freq type, being: 0 = undefined, 57 * 1 = satelite, 2 = cable or 3 = terrestrial. 58 */ 59 struct dvb_desc_frequency_list 60 { 61 align (1): 62 63 ubyte type; 64 ubyte length; 65 dvb_desc* next; 66 67 ubyte frequencies; 68 uint* frequency; 69 70 union 71 { 72 align (1): 73 74 ubyte bitfield; 75 76 struct 77 { 78 import std.bitmanip : bitfields; 79 align (1): 80 81 mixin(bitfields!( 82 ubyte, "freq_type", 2, 83 ubyte, "reserved", 6)); 84 } 85 } 86 } 87 88 // struct dvb_v5_fe_parms; 89 90 /** 91 * @brief Initializes and parses the frequency list descriptor 92 * @ingroup descriptors 93 * 94 * @param parms struct dvb_v5_fe_parms pointer to the opened device 95 * @param buf buffer containing the descriptor's raw data 96 * @param desc pointer to struct dvb_desc to be allocated and filled 97 * 98 * This function initializes and makes sure that all fields will follow the CPU 99 * endianness. Due to that, the content of the buffer may change. 100 * 101 * Currently, no memory is allocated internally. 102 * 103 * @return On success, it returns the size of the allocated struct. 104 * A negative value indicates an error. 105 */ 106 int dvb_desc_frequency_list_init ( 107 dvb_v5_fe_parms* parms, 108 const(ubyte)* buf, 109 dvb_desc* desc); 110 111 /** 112 * @brief Prints the content of the frequency list descriptor 113 * @ingroup descriptors 114 * 115 * @param parms struct dvb_v5_fe_parms pointer to the opened device 116 * @param desc pointer to struct dvb_desc 117 */ 118 void dvb_desc_frequency_list_print ( 119 dvb_v5_fe_parms* parms, 120 const(dvb_desc)* desc);